package com.company.huisuo.biz.activity

import android.content.Intent
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.company.huisuo.R
import com.company.huisuo.base.BaseActivity
import com.company.huisuo.biz.activity.KRoomActivity.Companion.TYPE_DANCE
import com.company.huisuo.biz.adapter.MainLeftTopAdapter
import com.company.huisuo.biz.bean.ArtistBean
import com.company.huisuo.databinding.ActivityMainBinding

/**
 * 首页
 */
class MainActivity : BaseActivity<ActivityMainBinding>() {

    private val mLeftTopAdapter by lazy {
        MainLeftTopAdapter()
    }

    companion object {
        fun start(activity: AppCompatActivity) {
            activity.startActivity(Intent(activity, MainActivity::class.java))
        }
    }

    override fun initView() {
        mBinding.rcvLeftTop.apply {
            layoutManager = LinearLayoutManager(this@MainActivity, RecyclerView.HORIZONTAL, false)
            adapter = mLeftTopAdapter
        }
        mLeftTopAdapter.submitList(mockLeftTopData())
        mLeftTopAdapter.setOnItemClickListener { adapter, view, position ->

        }

        mBinding.ivRecommend.setOnClickListener {
            //艺人推荐
            ArtistRecommendActivity.start(this)
        }
        mBinding.ivKroom.setOnClickListener {
            //我的K房
            KRoomActivity.start(this)
        }
        mBinding.ivLeftBottom1.setOnClickListener {
            //服务风格
            ServiceStyleActivity.start(this)
        }
        mBinding.ivLeftBottom2.setOnClickListener {
            //宵夜
            CartActivity.start(this)
        }
        mBinding.ivLeftBottom3.setOnClickListener {
            //登录会员
            MemberActivity.start(this)
        }
        mBinding.ivLeftBottom4.setOnClickListener {
            //服务反馈
            FeedBackActivity.start(this)
        }
        mBinding.flRightTop1.setOnClickListener {
            //艺人变装
            KRoomActivity.start(this)
        }
        mBinding.flRightTop2.setOnClickListener {
            //角色扮演
            KRoomActivity.start(this)
        }
        mBinding.ivRightBottom1.setOnClickListener {
            //私密趣玩
            DanceGameActivity.start(this)
        }
        mBinding.ivRightBottom2.setOnClickListener {
            //燃情劲舞
            KRoomActivity.start(this, TYPE_DANCE)
        }
    }

    override fun initData() {

    }

    private fun mockLeftTopData(): ArrayList<Pair<Int, String>> {
        val list = ArrayList<Pair<Int, String>>()
        list.add(Pair(R.drawable.ic_main_left_top_1, "爱乐团"))
        list.add(Pair(R.drawable.ic_main_left_top_2, "哈尼"))
        list.add(Pair(R.drawable.ic_main_left_top_3, "哈尼"))
        list.add(Pair(R.drawable.ic_main_left_top_1, "爱乐团"))
        list.add(Pair(R.drawable.ic_main_left_top_1, "爱乐团"))
        return list
    }
}